<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:msds="http://ehs-info.com/msds" xmlns="http://matsadaml.org/msds/v1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" exclude-result-prefixes="msds #default">
	<xsl:template match="/">
			<xsl:apply-templates/>
	</xsl:template>
	<xsl:template match="processing-instruction()">
		<xsl:copy/>
	</xsl:template>
	<xsl:template match="msds:exposureLimitRemarks">
		<exposureLimitRemarks xmlns="http://ehs-info.com/msds/v1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://ehs-info.com/msds/v1.0 ../System/Schema/msds_v1.0.xsd">
			<xsl:apply-templates select="node()"/>
		</exposureLimitRemarks>
	</xsl:template>
	<xsl:template match="msds:hazards">
		<hazards xmlns="http://ehs-info.com/msds/v1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://ehs-info.com/msds/v1.0 ../System/Schema/msds.xsd">
			<xsl:apply-templates select="node()"/>
		</hazards>
	</xsl:template>
	<xsl:template match="msds:riskPhrases">
		<riskPhrases xmlns="http://ehs-info.com/msds/v1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://ehs-info.com/msds/v1.0 ../System/Schema/msds.xsd">
			<xsl:apply-templates select="node()"/>
		</riskPhrases>
	</xsl:template>
	<xsl:template match="msds:safetyPhrases">
		<safetyPhrases xmlns="http://ehs-info.com/msds/v1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://ehs-info.com/msds/v1.0 ../System/Schema/msds.xsd">
			<xsl:apply-templates select="node()"/>
		</safetyPhrases>
	</xsl:template>
	<xsl:template match="node()">
		<xsl:choose>
			<xsl:when test="name()">
				<xsl:element name="{name()}">
					<xsl:apply-templates select="@* | node() | text()"/>
				</xsl:element>
			</xsl:when>
			<xsl:otherwise>
				<xsl:value-of select="."/>
			</xsl:otherwise>
		</xsl:choose>
	</xsl:template>
	<xsl:template match="@*">
		<xsl:copy/>
	</xsl:template>
	<xsl:template match="msds:remark">
		<remark>
			<xsl:attribute name="key"><xsl:value-of select="msds:code"/></xsl:attribute>
			<xsl:apply-templates select="@* | node()"/>
		</remark>
	</xsl:template>
	<xsl:template match="@id">
		<xsl:attribute name="key"><xsl:value-of select="parent::*/child::msds:code"/></xsl:attribute>
	</xsl:template>
	<xsl:template match="msds:text | msds:description">
		<xsl:element name="text">
			<xsl:attribute name="countries"><xsl:choose><xsl:when test="@lang = 'sv'">SE; </xsl:when><xsl:otherwise>UK; </xsl:otherwise></xsl:choose></xsl:attribute>
			<xsl:attribute name="lang"><xsl:value-of select="@lang"/></xsl:attribute>
			<xsl:apply-templates select="@* | node()"/>
		</xsl:element>
	</xsl:template>
</xsl:stylesheet>
